<?php
session_start();
include('lib/lib.php');
include('connado.php');
//include('authen.php');
header("Content-type: text/xml; charset=utf-8");
$logfile = PAHTLOG."ajax_getmt-" . date("Y-m-d") . ".log";

$emp_id = $_REQUEST['emp_id'];


writelog($logfile, "emp_id     : " . $emp_id);

$sql = "SELECT mt.m_id, mt.s_id, mt.e_id, mt.location_id FROM mainternace AS mt WHERE mt.e_id =? ";
$stmt = $db->Prepare($sql);
$arr_pre = array($emp_id);
$rs = $db->Execute($stmt, $arr_pre);
$html = '<result>';
$chk = true;
while($arr1 = $rs->FetchRow()){
	$html .='<tr>';
	if($arr1){
		$html .='<td width="25%" align="rigth" class="line_dash" ><input type="checkbox" name="exchname" value="'.$arr1['location_id'].'"/><span class="txt_module">'.$arr1['location_id'].'</span></td>';
	}else{
		$html .='<td width="25%" align="rigth" class="line_dash" >&nbsp;</td>';
	}
	if($arr2 = $rs->FetchRow()){
		$html .='<td width="25%" align="rigth" class="line_dash" ><input type="checkbox" name="exchname" value="'.$arr2['location_id'].'"/><span class="txt_module">'.$arr2['location_id'].'</span></td>';
	}else{
		$html .='<td width="25%" align="rigth" class="line_dash" >&nbsp;</td>';
	}
	if($arr3 = $rs->FetchRow()){
		$html .='<td width="25%" align="rigth" class="line_dash" ><input type="checkbox" name="exchname" value="'.$arr3['location_id'].'"/><span class="txt_module">'.$arr3['location_id'].'</span></td>';
	}else{
		$html .='<td width="25%" align="rigth" class="line_dash" >&nbsp;</td>';
	}
	if($arr4 = $rs->FetchRow()){
		$html .='<td width="25%" align="rigth" class="line_dash" ><input type="checkbox" name="exchname" value="'.$arr4['location_id'].'"/><span class="txt_module">'.$arr4['location_id'].'</span></td>';		
	}else{
		$html .='<td width="25%" align="rigth" class="line_dash" >&nbsp;</td>';
	}
	$html .='</tr>';	
}
$rs->close();
$html .= '</result>';
writelog($logfile, "reply : $xml");
writelog($logfile, "-------------------------------------------------- ");

echo $html;
?>

